/*
 * Generated file. 
 * 
 * AuthorProfileForm.java
 */
package xsp;

import com.ibm.xsp.page.compiled.AbstractCompiledPage;
import com.ibm.xsp.page.compiled.AbstractCompiledPageDispatcher;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import com.ibm.xsp.page.compiled.NoSuchComponentException;
import com.ibm.xsp.page.compiled.PageExpressionEvaluator;
import java.lang.String;
import java.lang.Object;
import java.lang.Integer;
import javax.faces.el.ValueBinding;
import com.ibm.xsp.model.domino.DominoDocumentData;
import javax.faces.el.MethodBinding;
import com.ibm.xsp.component.FacesDataProvider;
import com.ibm.xsp.component.UIViewRootEx2;
import java.lang.Boolean;
import com.ibm.xsp.extlib.component.mobile.UIDMHeading;
import com.ibm.xsp.component.UIPanelEx;
import com.ibm.xsp.extlib.component.dynamiccontent.UIDynamicContent;
import com.ibm.xsp.extlib.component.mobile.UIToolBarButton;
import com.ibm.xsp.component.xp.XspEventHandler;
import com.ibm.xsp.actions.ActionGroup;
import com.ibm.xsp.actions.SaveDocumentAction;
import com.ibm.xsp.actions.ChangeDocumentModeAction;
import com.ibm.xsp.extlib.actions.MoveToAction;
import com.ibm.xsp.extlib.actions.server.ChangeDynamicContentAction;
import com.ibm.xsp.actions.ExecuteScriptAction;
import com.ibm.xsp.extlib.component.data.UIFormTable;
import com.ibm.xsp.extlib.component.data.UIFormLayoutRow;
import com.ibm.xsp.component.xp.XspGraphicImage;
import com.ibm.xsp.component.xp.XspFileUpload;
import com.ibm.xsp.component.xp.XspInputText;
import com.ibm.xsp.component.xp.XspCommandButton;
import com.ibm.xsp.actions.SaveAction;
import com.ibm.xsp.component.xp.XspOutputLink;
import java.util.Map;

@SuppressWarnings("all")
public class AuthorProfileForm extends AbstractCompiledPageDispatcher{

    private static final String[][] s_libraryVersions = new String[][]{
        {"com.ibm.xsp.extlib.library", "8.5.32006"},  // version of "xe:toolBarButton"
    };
    
    public AuthorProfileForm() {
        super("8.5.2"); // version of xp:fileUpload role
    }

    protected String[][] getLibraryTagVersions() {
        return s_libraryVersions;
    }

    protected AbstractCompiledPage createPage(int pageIndex) {
        return new AuthorProfileFormPage();
    }
    
    protected boolean isCustomControl() {
        return true;
    }

    public static class AuthorProfileFormPage extends AbstractCompiledPage {
        
        private static final ComponentInfo[] s_infos = new ComponentInfo[]{
            ComponentInfo.EMPTY_NORMAL, // 0 eventHandler
            new ComponentInfo(false, new int[]{0}), // 1 "savebutton"
            new ComponentInfo(false, new int[]{1}), // 2 "panel2"
            ComponentInfo.EMPTY_NORMAL, // 3 eventHandler2
            new ComponentInfo(false, new int[]{3}), // 4 "editbutton"
            new ComponentInfo(false, new int[]{4}), // 5 panel3
            new ComponentInfo(false, null, // 6 "dynamiccontent1"
              new Object[][]{
                new Object[]{"saveControl", Integer.valueOf(2)},
                new Object[]{"editControl", Integer.valueOf(5)},
              } ),
            new ComponentInfo(false, new int[]{6}), // 7 panel
            new ComponentInfo(false, null, // 8 "djxmheading3"
              new Object[][]{
                new Object[]{"actionFacet", Integer.valueOf(7)},
              } ),
            ComponentInfo.EMPTY_NORMAL, // 9 "photo"
            ComponentInfo.EMPTY_NORMAL, // 10 "profileimage"
            new ComponentInfo(false, new int[]{9, 10}), // 11 "formrow1"
            ComponentInfo.EMPTY_NORMAL, // 12 "email"
            new ComponentInfo(false, new int[]{12}), // 13 "formrow3"
            ComponentInfo.EMPTY_NORMAL, // 14 "phone"
            new ComponentInfo(false, new int[]{14}), // 15 "formrow4"
            ComponentInfo.EMPTY_NORMAL, // 16 "role"
            new ComponentInfo(false, new int[]{16}), // 17 "formrow5"
            ComponentInfo.EMPTY_NORMAL, // 18 "goals"
            new ComponentInfo(false, new int[]{18}), // 19 "formrow7"
            new ComponentInfo(false, new int[]{11, 13, 15, 17, 19}), // 20 "formtable1"
            ComponentInfo.EMPTY_NORMAL, // 21 eventHandler3
            new ComponentInfo(false, new int[]{21}), // 22 "button2"
            ComponentInfo.EMPTY_NORMAL, // 23 "linkcancel"
            new ComponentInfo(false, new int[]{22, 23}), // 24 "panel16"
            ComponentInfo.EMPTY_NORMAL, // 25 eventHandler4
            new ComponentInfo(false, new int[]{25}), // 26 "button1"
            new ComponentInfo(false, new int[]{26}), // 27 "panel1"
            new ComponentInfo(false, null, // 28 "dynamiccontent4"
              new Object[][]{
                new Object[]{"saveControl", Integer.valueOf(24)},
                new Object[]{"editControl", Integer.valueOf(27)},
              } ),
            new ComponentInfo(false, new int[]{28}), // 29 "panel17"
            new ComponentInfo(false, new int[]{8, 20, 29}), // 30 view
        };
        
        public AuthorProfileFormPage() {
            super(30, s_infos );
        }
        
        public int getComponentForId(String id) throws NoSuchComponentException { 
            if( "djxmheading3".equals(id) )
                return 8;
            if( "dynamiccontent1".equals(id) )
                return 6;
            if( "panel2".equals(id) )
                return 2;
            if( "savebutton".equals(id) )
                return 1;
            if( "editbutton".equals(id) )
                return 4;
            if( "formtable1".equals(id) )
                return 20;
            if( "formrow1".equals(id) )
                return 11;
            if( "photo".equals(id) )
                return 9;
            if( "profileimage".equals(id) )
                return 10;
            if( "formrow3".equals(id) )
                return 13;
            if( "email".equals(id) )
                return 12;
            if( "formrow4".equals(id) )
                return 15;
            if( "phone".equals(id) )
                return 14;
            if( "formrow5".equals(id) )
                return 17;
            if( "role".equals(id) )
                return 16;
            if( "formrow7".equals(id) )
                return 19;
            if( "goals".equals(id) )
                return 18;
            if( "panel17".equals(id) )
                return 29;
            if( "dynamiccontent4".equals(id) )
                return 28;
            if( "panel16".equals(id) )
                return 24;
            if( "button2".equals(id) )
                return 22;
            if( "linkcancel".equals(id) )
                return 23;
            if( "panel1".equals(id) )
                return 27;
            if( "button1".equals(id) )
                return 26;
            return -1;
        }
        
        public UIComponent createComponent(int id, FacesContext context,
                UIComponent parent, PageExpressionEvaluator evaluator)
                throws NoSuchComponentException { 
            switch (id) {
            case 30:
                return createView(context, parent, evaluator);
            case 8:
                return createDjxmheading3(context, parent, evaluator);
            case 7:
                return createPanel(context, parent, evaluator);
            case 6:
                return createDynamiccontent1(context, parent, evaluator);
            case 2:
                return createPanel2(context, parent, evaluator);
            case 1:
                return createSavebutton(context, parent, evaluator);
            case 0:
                return createEventHandler(context, parent, evaluator);
            case 5:
                return createPanel3(context, parent, evaluator);
            case 4:
                return createEditbutton(context, parent, evaluator);
            case 3:
                return createEventHandler2(context, parent, evaluator);
            case 20:
                return createFormtable1(context, parent, evaluator);
            case 11:
                return createFormrow1(context, parent, evaluator);
            case 9:
                return createPhoto(context, parent, evaluator);
            case 10:
                return createProfileimage(context, parent, evaluator);
            case 13:
                return createFormrow3(context, parent, evaluator);
            case 12:
                return createEmail(context, parent, evaluator);
            case 15:
                return createFormrow4(context, parent, evaluator);
            case 14:
                return createPhone(context, parent, evaluator);
            case 17:
                return createFormrow5(context, parent, evaluator);
            case 16:
                return createRole(context, parent, evaluator);
            case 19:
                return createFormrow7(context, parent, evaluator);
            case 18:
                return createGoals(context, parent, evaluator);
            case 29:
                return createPanel17(context, parent, evaluator);
            case 28:
                return createDynamiccontent4(context, parent, evaluator);
            case 24:
                return createPanel16(context, parent, evaluator);
            case 22:
                return createButton2(context, parent, evaluator);
            case 21:
                return createEventHandler3(context, parent, evaluator);
            case 23:
                return createLinkcancel(context, parent, evaluator);
            case 27:
                return createPanel1(context, parent, evaluator);
            case 26:
                return createButton1(context, parent, evaluator);
            case 25:
                return createEventHandler4(context, parent, evaluator);
            }
            throw new NoSuchComponentException(id);
        }
        
        protected void initIncluderAsRoot(FacesContext context,
                PageExpressionEvaluator evaluator, UIComponent root) {
            String sourceId = "/xp:view[1]/@enableModifiedFlag";
            String enableModifiedFlagExpr = "#{javascript:!isMobile()}";
            ValueBinding enableModifiedFlag = evaluator.createValueBinding(root, enableModifiedFlagExpr, sourceId,boolean.class);
            root.setValueBinding("enableModifiedFlag", enableModifiedFlag);
            DominoDocumentData data = new DominoDocumentData();
            data.setComponent(root);
            String sourceId2 = "/xp:view[1]/xp:this.data[1]/xp:dominoDocument[1]/xp:this.querySaveDocument[1]/text()";
            MethodBinding querySaveDocument = evaluator.createMethodBinding(root,
                    "#{javascript:// flush out the old image if updating with a new one...\nif(!profileDoc.isNewNote()){\n\tvar al:java.util.List = profileDoc.getAttachmentList(\"attachment\");\n\tif(!al.isEmpty()){\n\t\tvar lastItemIndex = al.size() - 1;\n\t\tif(lastItemIndex > 0){\n\t\t\tfor(var i = lastItemIndex - 1; i >= 0; i--){\n\t\t\t\tvar eo:NotesEmbeddedObject = al.get(i);\n\t\t\t\tprofileDoc.removeAttachment(\"attachment\", eo.getName());\n\t\t\t}\n\t\t}\n\t}\n}\n\n// store user CGI variables...\nvar cgi = new CGIVariables();\nprofileDoc.replaceItemValue(\"Remote_User\", cgi.get(\"REMOTE_USER\"));\nprofileDoc.replaceItemValue(\"Remote_Addr\", cgi.get(\"REMOTE_ADDR\"));\ncgi = null;}",
                    null,null, sourceId2);
            data.setQuerySaveDocument(querySaveDocument);
            data.setComputeWithForm("onsave");
            data.setIgnoreRequestParams(true);
            String sourceId3 = "/xp:view[1]/xp:this.data[1]/xp:dominoDocument[1]/xp:this.action[1]/text()";
            String actionExpr = "#{javascript:// obtain the document id for the logged in user if it exists...\nvar db:NotesDatabase\t= database;\nvar vw:NotesView\t\t= db.getView(\"xpAuthorProfiles\");\nvar ve:NotesViewEntry\t= vw.getEntryByKey(userBean.canonicalName, true);\n\nif (null != ve) {\n\treturn(\"openDocument\");\n}\nreturn(\"newDocument\");}";
            ValueBinding action = evaluator.createValueBinding(root, actionExpr, sourceId3,String.class);
            data.setValueBinding("action", action);
            String sourceId4 = "/xp:view[1]/xp:this.data[1]/xp:dominoDocument[1]/xp:this.documentId[1]/text()";
            String documentIdExpr = "#{javascript:// obtain the document id for the logged in user if it exists...\nvar db:NotesDatabase\t= database;\nvar vw:NotesView\t\t= db.getView(\"xpAuthorProfiles\");\nvar ve:NotesViewEntry\t= vw.getEntryByKey(userBean.canonicalName, true);\nvar unid\t\t\t\t= null;\n\nif (null != ve) {\n\tunid = ve.getUniversalID();\n}\nreturn(unid);}";
            ValueBinding documentId = evaluator.createValueBinding(root, documentIdExpr, sourceId4,String.class);
            data.setValueBinding("documentId", documentId);
            data.setVar("profileDoc");
            data.setFormName("PersonalProfile");
            FacesDataProvider asDataProvider = root instanceof FacesDataProvider ?
                    (FacesDataProvider) root : null;
            if( null != asDataProvider ){
                asDataProvider.addData(data);
            }
        }

        private UIComponent createView(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            UIViewRootEx2 result = new UIViewRootEx2();
            initViewRoot(result);
            String sourceId = "/xp:view[1]/@enableModifiedFlag";
            String enableModifiedFlagExpr = "#{javascript:!isMobile()}";
            ValueBinding enableModifiedFlag = evaluator.createValueBinding(result, enableModifiedFlagExpr, sourceId,boolean.class);
            result.setValueBinding("enableModifiedFlag", enableModifiedFlag);
            DominoDocumentData data = new DominoDocumentData();
            data.setComponent(result);
            String sourceId2 = "/xp:view[1]/xp:this.data[1]/xp:dominoDocument[1]/xp:this.querySaveDocument[1]/text()";
            MethodBinding querySaveDocument = evaluator.createMethodBinding(result,
                    "#{javascript:// flush out the old image if updating with a new one...\nif(!profileDoc.isNewNote()){\n\tvar al:java.util.List = profileDoc.getAttachmentList(\"attachment\");\n\tif(!al.isEmpty()){\n\t\tvar lastItemIndex = al.size() - 1;\n\t\tif(lastItemIndex > 0){\n\t\t\tfor(var i = lastItemIndex - 1; i >= 0; i--){\n\t\t\t\tvar eo:NotesEmbeddedObject = al.get(i);\n\t\t\t\tprofileDoc.removeAttachment(\"attachment\", eo.getName());\n\t\t\t}\n\t\t}\n\t}\n}\n\n// store user CGI variables...\nvar cgi = new CGIVariables();\nprofileDoc.replaceItemValue(\"Remote_User\", cgi.get(\"REMOTE_USER\"));\nprofileDoc.replaceItemValue(\"Remote_Addr\", cgi.get(\"REMOTE_ADDR\"));\ncgi = null;}",
                    null,null, sourceId2);
            data.setQuerySaveDocument(querySaveDocument);
            data.setComputeWithForm("onsave");
            data.setIgnoreRequestParams(true);
            String sourceId3 = "/xp:view[1]/xp:this.data[1]/xp:dominoDocument[1]/xp:this.action[1]/text()";
            String actionExpr = "#{javascript:// obtain the document id for the logged in user if it exists...\nvar db:NotesDatabase\t= database;\nvar vw:NotesView\t\t= db.getView(\"xpAuthorProfiles\");\nvar ve:NotesViewEntry\t= vw.getEntryByKey(userBean.canonicalName, true);\n\nif (null != ve) {\n\treturn(\"openDocument\");\n}\nreturn(\"newDocument\");}";
            ValueBinding action = evaluator.createValueBinding(result, actionExpr, sourceId3,String.class);
            data.setValueBinding("action", action);
            String sourceId4 = "/xp:view[1]/xp:this.data[1]/xp:dominoDocument[1]/xp:this.documentId[1]/text()";
            String documentIdExpr = "#{javascript:// obtain the document id for the logged in user if it exists...\nvar db:NotesDatabase\t= database;\nvar vw:NotesView\t\t= db.getView(\"xpAuthorProfiles\");\nvar ve:NotesViewEntry\t= vw.getEntryByKey(userBean.canonicalName, true);\nvar unid\t\t\t\t= null;\n\nif (null != ve) {\n\tunid = ve.getUniversalID();\n}\nreturn(unid);}";
            ValueBinding documentId = evaluator.createValueBinding(result, documentIdExpr, sourceId4,String.class);
            data.setValueBinding("documentId", documentId);
            data.setVar("profileDoc");
            data.setFormName("PersonalProfile");
            result.addData(data);
            return result;
        }

        private UIComponent createDjxmheading3(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            // loaded=??
            String loadedBnd = "#{javascript:isMobile()}";
            String sourceId = "djxmHeading3/@loaded";
            String loaded = evaluator.evaluateAsString(null, loadedBnd, sourceId, boolean.class);
            if ( null != loaded && loaded.length() > 0 &&
                    ! Boolean.parseBoolean(loaded) ) {
                return null;
            } // else loaded was true
            UIDMHeading result = new UIDMHeading();
            result.setLabel("By Author");
            String sourceId2 = "djxmHeading3/xp:this.back[1]/text()";
            String backExpr = "#{javascript:\n\t\t\tif(viewScope.editMode)\n\t\t\t\treturn res.getString(\"mobile.cancel\");\n\t\t\treturn res.getString(\"mobile.back\");\n\t\t}";
            ValueBinding back = evaluator.createValueBinding(result, backExpr, sourceId2,String.class);
            result.setValueBinding("back", back);
            setId(result, "djxmHeading3");
            result.setMoveTo("home");
            return result;
        }

        private UIComponent createPanel(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            UIPanelEx result = new UIPanelEx();
            return result;
        }

        private UIComponent createDynamiccontent1(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            UIDynamicContent result = new UIDynamicContent();
            String sourceId = "dynamicContent1/xp:this.defaultFacet[1]/text()";
            String defaultFacetExpr = "#{javascript: \n\t\t\t\t\t\t\tif(profileDoc.getItemValueString(\"Email\") === null || profileDoc.getItemValueString(\"Email\") === \"\")\n\t\t\t\t\t\t\t{return \"saveControl\";}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{return \"editControl\";}\n\t\t\t\t\t\t}";
            ValueBinding defaultFacet = evaluator.createValueBinding(result, defaultFacetExpr, sourceId,String.class);
            result.setValueBinding("defaultFacet", defaultFacet);
            setId(result, "dynamicContent1");
            return result;
        }

        private UIComponent createPanel2(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            UIPanelEx result = new UIPanelEx();
            setId(result, "panel2");
            return result;
        }

        private UIComponent createSavebutton(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            UIToolBarButton result = new UIToolBarButton();
            result.setLabel("Save");
            setId(result, "saveButton");
            return result;
        }

        private UIComponent createEventHandler(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            XspEventHandler result = new XspEventHandler();
            ActionGroup action = new ActionGroup();
            action.setComponent(result);
            SaveDocumentAction actions = new SaveDocumentAction();
            actions.setComponent(result);
            actions.setVar("profileDoc");
            actions.setSourceReferenceId("saveButton/xp:eventHandler[1]/xp:this.action[1]/xp:actionGroup[1]/xp:saveDocument[1]");
            action.addAction(actions);
            ChangeDocumentModeAction actions2 = new ChangeDocumentModeAction();
            actions2.setComponent(result);
            actions2.setMode("readOnly");
            actions2.setVar("profileDoc");
            actions2.setSourceReferenceId("saveButton/xp:eventHandler[1]/xp:this.action[1]/xp:actionGroup[1]/xp:changeDocumentMode[1]");
            action.addAction(actions2);
            MoveToAction actions3 = new MoveToAction();
            actions3.setComponent(result);
            actions3.setTargetPage("home");
            actions3.setForceFullRefresh(true);
            actions3.setTransitionType("slide");
            actions3.setDirection("Left to Right");
            actions3.setSourceReferenceId("saveButton/xp:eventHandler[1]/xp:this.action[1]/xp:actionGroup[1]/xe:moveTo[1]");
            action.addAction(actions3);
            ChangeDynamicContentAction actions4 = new ChangeDynamicContentAction();
            actions4.setComponent(result);
            actions4.setFacetName("editControl");
            actions4.setFor("dynamicContent1");
            actions4.setSourceReferenceId("saveButton/xp:eventHandler[1]/xp:this.action[1]/xp:actionGroup[1]/xe:changeDynamicContentAction[1]");
            action.addAction(actions4);
            ExecuteScriptAction actions5 = new ExecuteScriptAction();
            actions5.setComponent(result);
            String sourceId = "saveButton/xp:eventHandler[1]/xp:this.action[1]/xp:actionGroup[1]/xp:executeScript[1]/@script";
            MethodBinding script = evaluator.createMethodBinding(result,
                    "#{javascript:viewScope.editMode = false;}",
                    null,null, sourceId);
            actions5.setScript(script);
            actions5.setSourceReferenceId("saveButton/xp:eventHandler[1]/xp:this.action[1]/xp:actionGroup[1]/xp:executeScript[1]");
            action.addAction(actions5);
            action.setSourceReferenceId("saveButton/xp:eventHandler[1]/xp:this.action[1]/xp:actionGroup[1]");
            result.setAction(action);
            result.setSubmit(true);
            result.setEvent("onclick");
            result.setSave(false);
            result.setRefreshMode("complete");
            return result;
        }

        private UIComponent createPanel3(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            UIPanelEx result = new UIPanelEx();
            return result;
        }

        private UIComponent createEditbutton(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            UIToolBarButton result = new UIToolBarButton();
            result.setLabel("Edit");
            setId(result, "editButton");
            return result;
        }

        private UIComponent createEventHandler2(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            XspEventHandler result = new XspEventHandler();
            ActionGroup action = new ActionGroup();
            action.setComponent(result);
            ChangeDocumentModeAction actions = new ChangeDocumentModeAction();
            actions.setComponent(result);
            actions.setMode("edit");
            actions.setVar("profileDoc");
            actions.setSourceReferenceId("editButton/xp:eventHandler[1]/xp:this.action[1]/xp:actionGroup[1]/xp:changeDocumentMode[1]");
            action.addAction(actions);
            ChangeDynamicContentAction actions2 = new ChangeDynamicContentAction();
            actions2.setComponent(result);
            actions2.setFacetName("saveControl");
            actions2.setFor("dynamicContent1");
            actions2.setSourceReferenceId("editButton/xp:eventHandler[1]/xp:this.action[1]/xp:actionGroup[1]/xe:changeDynamicContentAction[1]");
            action.addAction(actions2);
            ExecuteScriptAction actions3 = new ExecuteScriptAction();
            actions3.setComponent(result);
            String sourceId = "editButton/xp:eventHandler[1]/xp:this.action[1]/xp:actionGroup[1]/xp:executeScript[1]/@script";
            MethodBinding script = evaluator.createMethodBinding(result,
                    "#{javascript:viewScope.editMode = true;}",
                    null,null, sourceId);
            actions3.setScript(script);
            actions3.setSourceReferenceId("editButton/xp:eventHandler[1]/xp:this.action[1]/xp:actionGroup[1]/xp:executeScript[1]");
            action.addAction(actions3);
            action.setSourceReferenceId("editButton/xp:eventHandler[1]/xp:this.action[1]/xp:actionGroup[1]");
            result.setAction(action);
            result.setSubmit(true);
            result.setEvent("onclick");
            result.setRefreshMode("complete");
            return result;
        }

        private UIComponent createFormtable1(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            UIFormTable result = new UIFormTable();
            String sourceId = "formTable1/xp:this.formTitle[1]/text()";
            String formTitleExpr = "#{javascript:I18n.format(res.getString(\"authorProfile.mobile.title\"), userBean.commonName)}";
            ValueBinding formTitle = evaluator.createValueBinding(result, formTitleExpr, sourceId,String.class);
            result.setValueBinding("formTitle", formTitle);
            setId(result, "formTable1");
            result.setLegend("Author profile form");
            return result;
        }

        private UIComponent createFormrow1(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            UIFormLayoutRow result = new UIFormLayoutRow();
            setId(result, "formRow1");
            result.setLabelPosition("none");
            return result;
        }

        private UIComponent createPhoto(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            XspGraphicImage result = new XspGraphicImage();
            result.setWidth("130px");
            result.setHeight("130px");
            result.setTitle("");
            result.setAlt("");
            setId(result, "photo");
            String sourceId = "photo/xp:this.url[1]/text()";
            String urlExpr = "#{javascript:var imageName:String = \"xpPhotoPlaceholder.gif\";\n\t\t\t\tif(!profileDoc.isNewNote())\n\t\t\t\t{\n\t\t\t\t\tvar al:java.util.List = profileDoc.getAttachmentList(\"attachment\");\n\t\t\t\t\tif(!al.isEmpty())\n\t\t\t\t\t{\n\t\t\t\t\t\tvar eo:NotesEmbeddedObject = al.get(0);\n\t\t\t\t\t\timageName = eo.getHref();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn(imageName);}";
            ValueBinding url = evaluator.createValueBinding(result, urlExpr, sourceId,String.class);
            result.setValueBinding("url", url);
            return result;
        }

        private UIComponent createProfileimage(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            // loaded=??
            String loadedBnd = "#{javascript:!isMobile()}";
            String sourceId = "profileImage/@loaded";
            String loaded = evaluator.evaluateAsString(null, loadedBnd, sourceId, boolean.class);
            if ( null != loaded && loaded.length() > 0 &&
                    ! Boolean.parseBoolean(loaded) ) {
                return null;
            } // else loaded was true
            XspFileUpload result = new XspFileUpload();
            String sourceId2 = "profileImage/@value";
            String valueExpr = "#{profileDoc.attachment}";
            ValueBinding value = evaluator.createValueBinding(result, valueExpr, sourceId2,Object.class);
            result.setValueBinding("value", value);
            result.setRole("upload a file with document");
            result.setStyleClass("webAuthorUpload");
            result.setTitle("file upload control");
            setId(result, "profileImage");
            return result;
        }

        private UIComponent createFormrow3(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            UIFormLayoutRow result = new UIFormLayoutRow();
            result.setLabel("Email: ");
            setId(result, "formRow3");
            return result;
        }

        private UIComponent createEmail(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            XspInputText result = new XspInputText();
            String sourceId = "Email/@value";
            String valueExpr = "#{profileDoc.Email}";
            ValueBinding value = evaluator.createValueBinding(result, valueExpr, sourceId,Object.class);
            result.setValueBinding("value", value);
            result.setSize(15);
            String sourceId2 = "Email/@disableClientSideValidation";
            String disableClientSideValidationExpr = "#{javascript:!isMobile()}";
            ValueBinding disableClientSideValidation = evaluator.createValueBinding(result, disableClientSideValidationExpr, sourceId2,boolean.class);
            result.setValueBinding("disableClientSideValidation", disableClientSideValidation);
            setId(result, "Email");
            result.setRequired(true);
            return result;
        }

        private UIComponent createFormrow4(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            UIFormLayoutRow result = new UIFormLayoutRow();
            result.setLabel("Phone: ");
            setId(result, "formRow4");
            return result;
        }

        private UIComponent createPhone(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            XspInputText result = new XspInputText();
            String sourceId = "Phone/@value";
            String valueExpr = "#{profileDoc.Phone}";
            ValueBinding value = evaluator.createValueBinding(result, valueExpr, sourceId,Object.class);
            result.setValueBinding("value", value);
            result.setSize(15);
            setId(result, "Phone");
            result.setRequired(false);
            return result;
        }

        private UIComponent createFormrow5(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            UIFormLayoutRow result = new UIFormLayoutRow();
            result.setLabel("Role: ");
            setId(result, "formRow5");
            return result;
        }

        private UIComponent createRole(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            XspInputText result = new XspInputText();
            String sourceId = "Role/@value";
            String valueExpr = "#{profileDoc.Role}";
            ValueBinding value = evaluator.createValueBinding(result, valueExpr, sourceId,Object.class);
            result.setValueBinding("value", value);
            result.setSize(15);
            String sourceId2 = "Role/@disableClientSideValidation";
            String disableClientSideValidationExpr = "#{javascript:!isMobile()}";
            ValueBinding disableClientSideValidation = evaluator.createValueBinding(result, disableClientSideValidationExpr, sourceId2,boolean.class);
            result.setValueBinding("disableClientSideValidation", disableClientSideValidation);
            setId(result, "Role");
            result.setRequired(true);
            return result;
        }

        private UIComponent createFormrow7(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            UIFormLayoutRow result = new UIFormLayoutRow();
            result.setLabel("Goals: ");
            setId(result, "formRow7");
            return result;
        }

        private UIComponent createGoals(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            XspInputText result = new XspInputText();
            String sourceId = "Goals/@value";
            String valueExpr = "#{profileDoc.Goal}";
            ValueBinding value = evaluator.createValueBinding(result, valueExpr, sourceId,Object.class);
            result.setValueBinding("value", value);
            result.setSize(15);
            setId(result, "Goals");
            result.setRequired(false);
            return result;
        }

        private UIComponent createPanel17(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            UIPanelEx result = new UIPanelEx();
            result.setStyleClass("webFormFooter");
            setId(result, "panel17");
            return result;
        }

        private UIComponent createDynamiccontent4(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            // loaded=??
            String loadedBnd = "#{javascript:!isMobile()}";
            String sourceId = "dynamicContent4/@loaded";
            String loaded = evaluator.evaluateAsString(null, loadedBnd, sourceId, boolean.class);
            if ( null != loaded && loaded.length() > 0 &&
                    ! Boolean.parseBoolean(loaded) ) {
                return null;
            } // else loaded was true
            UIDynamicContent result = new UIDynamicContent();
            String sourceId2 = "dynamicContent4/xp:this.defaultFacet[1]/text()";
            String defaultFacetExpr = "#{javascript: \n\t\t\t\t\tif(profileDoc.getItemValueString(\"Email\") === null || profileDoc.getItemValueString(\"Email\") === \"\")\n\t\t\t\t\t{return \"saveControl\";}\n\t\t\t\t\telse\n\t\t\t\t\t{return \"editControl\";}\n\t\t\t\t}";
            ValueBinding defaultFacet = evaluator.createValueBinding(result, defaultFacetExpr, sourceId2,String.class);
            result.setValueBinding("defaultFacet", defaultFacet);
            setId(result, "dynamicContent4");
            return result;
        }

        private UIComponent createPanel16(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            UIPanelEx result = new UIPanelEx();
            result.setStyleClass("webFormFooterFacet");
            setId(result, "panel16");
            return result;
        }

        private UIComponent createButton2(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            XspCommandButton result = new XspCommandButton();
            result.setValue("Save");
            result.setRole("submit");
            result.setTitle("save button for author form");
            setId(result, "button2");
            return result;
        }

        private UIComponent createEventHandler3(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            XspEventHandler result = new XspEventHandler();
            SaveAction action = new SaveAction();
            action.setComponent(result);
            action.setName("/authorProfile.xsp");
            action.setSourceReferenceId("button2/xp:eventHandler[1]/xp:this.action[1]/xp:save[1]");
            result.setAction(action);
            result.setSubmit(true);
            result.setEvent("onclick");
            result.setSave(false);
            result.setRefreshMode("complete");
            return result;
        }

        private UIComponent createLinkcancel(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            XspOutputLink result = new XspOutputLink();
            result.setValue("/allDocuments.xsp");
            Map<String,Object> attrs = getAttributes(result);
            attrs.put("themeId", "Link.action");
            result.setRole("button");
            setId(result, "linkCancel");
            result.setText("Cancel");
            return result;
        }

        private UIComponent createPanel1(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            UIPanelEx result = new UIPanelEx();
            result.setStyleClass("webFormFooterFacet");
            setId(result, "panel1");
            return result;
        }

        private UIComponent createButton1(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            XspCommandButton result = new XspCommandButton();
            result.setValue("Edit");
            setId(result, "button1");
            return result;
        }

        private UIComponent createEventHandler4(FacesContext context, 
                UIComponent parent, PageExpressionEvaluator evaluator) {
            XspEventHandler result = new XspEventHandler();
            ActionGroup action = new ActionGroup();
            action.setComponent(result);
            ChangeDocumentModeAction actions = new ChangeDocumentModeAction();
            actions.setComponent(result);
            actions.setMode("edit");
            actions.setVar("profileDoc");
            actions.setSourceReferenceId("button1/xp:eventHandler[1]/xp:this.action[1]/xp:actionGroup[1]/xp:changeDocumentMode[1]");
            action.addAction(actions);
            ChangeDynamicContentAction actions2 = new ChangeDynamicContentAction();
            actions2.setComponent(result);
            actions2.setFacetName("saveControl");
            actions2.setFor("dynamicContent4");
            actions2.setSourceReferenceId("button1/xp:eventHandler[1]/xp:this.action[1]/xp:actionGroup[1]/xe:changeDynamicContentAction[1]");
            action.addAction(actions2);
            action.setSourceReferenceId("button1/xp:eventHandler[1]/xp:this.action[1]/xp:actionGroup[1]");
            result.setAction(action);
            result.setSubmit(true);
            result.setEvent("onclick");
            result.setRefreshMode("complete");
            return result;
        }

    }
}
